/**
 * output package name
 */
package com.kingdee.eas.minghua.report.tgcl;

import java.awt.event.ActionEvent;
import java.math.BigDecimal;
import java.sql.SQLException;

import org.apache.log4j.Logger;

import com.kingdee.bos.dao.query.SQLExecutorFactory;
import com.kingdee.bos.ui.face.CoreUIObject;
import com.kingdee.eas.framework.ICoreBase;
import com.kingdee.jdbc.rowset.IRowSet;

/**
 * output class name
 */
public class ClxedzbUI extends AbstractClxedzbUI
{
    private static final Logger logger = CoreUIObject.getLogger(ClxedzbUI.class);
    
    /**
     * output class constructor
     */
    public ClxedzbUI() throws Exception
    {
        super();
    }

    /**
     * output storeFields method
     */
    public void storeFields()
    {
        super.storeFields();
    }

    /**
     * output tblMain_tableClicked method
     */
    protected void tblMain_tableClicked(com.kingdee.bos.ctrl.kdf.table.event.KDTMouseEvent e) throws Exception
    {
        super.tblMain_tableClicked(e);
    }

    /**
     * output menuItemImportData_actionPerformed method
     */
    protected void menuItemImportData_actionPerformed(java.awt.event.ActionEvent e) throws Exception
    {
        super.menuItemImportData_actionPerformed(e);
    }

    /**
     * output actionPageSetup_actionPerformed
     */
    public void actionPageSetup_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionPageSetup_actionPerformed(e);
    }

    /**
     * output actionExitCurrent_actionPerformed
     */
    public void actionExitCurrent_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionExitCurrent_actionPerformed(e);
    }

    /**
     * output actionHelp_actionPerformed
     */
    public void actionHelp_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionHelp_actionPerformed(e);
    }

    /**
     * output actionAbout_actionPerformed
     */
    public void actionAbout_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionAbout_actionPerformed(e);
    }

    /**
     * output actionOnLoad_actionPerformed
     */
    public void actionOnLoad_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionOnLoad_actionPerformed(e);
    }

    /**
     * output actionSendMessage_actionPerformed
     */
    public void actionSendMessage_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionSendMessage_actionPerformed(e);
    }

    /**
     * output actionCalculator_actionPerformed
     */
    public void actionCalculator_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionCalculator_actionPerformed(e);
    }

    /**
     * output actionExport_actionPerformed
     */
    public void actionExport_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionExport_actionPerformed(e);
    }

    /**
     * output actionExportSelected_actionPerformed
     */
    public void actionExportSelected_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionExportSelected_actionPerformed(e);
    }

    /**
     * output actionRegProduct_actionPerformed
     */
    public void actionRegProduct_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionRegProduct_actionPerformed(e);
    }

    /**
     * output actionPersonalSite_actionPerformed
     */
    public void actionPersonalSite_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionPersonalSite_actionPerformed(e);
    }

    /**
     * output actionProcductVal_actionPerformed
     */
    public void actionProcductVal_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionProcductVal_actionPerformed(e);
    }

    /**
     * output actionAddNew_actionPerformed
     */
    public void actionAddNew_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionAddNew_actionPerformed(e);
    }

    /**
     * output actionView_actionPerformed
     */
    public void actionView_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionView_actionPerformed(e);
    }

    /**
     * output actionEdit_actionPerformed
     */
    public void actionEdit_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionEdit_actionPerformed(e);
    }

    /**
     * output actionRemove_actionPerformed
     */
    public void actionRemove_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionRemove_actionPerformed(e);
    }

    /**
     * output actionRefresh_actionPerformed
     */
    public void actionRefresh_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionRefresh_actionPerformed(e);
    }

    /**
     * output actionPrint_actionPerformed
     */
    public void actionPrint_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionPrint_actionPerformed(e);
    }

    /**
     * output actionPrintPreview_actionPerformed
     */
    public void actionPrintPreview_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionPrintPreview_actionPerformed(e);
    }

    /**
     * output actionLocate_actionPerformed
     */
    public void actionLocate_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionLocate_actionPerformed(e);
    }

    /**
     * output actionQuery_actionPerformed
     */
    public void actionQuery_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionQuery_actionPerformed(e);
    }

    /**
     * output actionImportData_actionPerformed
     */
    public void actionImportData_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionImportData_actionPerformed(e);
    }

    /**
     * output actionAttachment_actionPerformed
     */
    public void actionAttachment_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionAttachment_actionPerformed(e);
    }

    /**
     * output actionExportData_actionPerformed
     */
    public void actionExportData_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionExportData_actionPerformed(e);
    }

    /**
     * output actionToExcel_actionPerformed
     */
    public void actionToExcel_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionToExcel_actionPerformed(e);
    }

    /**
     * output actionStartWorkFlow_actionPerformed
     */
    public void actionStartWorkFlow_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionStartWorkFlow_actionPerformed(e);
    }

    /**
     * output actionPublishReport_actionPerformed
     */
    public void actionPublishReport_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionPublishReport_actionPerformed(e);
    }

    /**
     * output actionCancel_actionPerformed
     */
    public void actionCancel_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionCancel_actionPerformed(e);
    }

    /**
     * output actionCancelCancel_actionPerformed
     */
    public void actionCancelCancel_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionCancelCancel_actionPerformed(e);
    }

    /**
     * output actionQueryScheme_actionPerformed
     */
    public void actionQueryScheme_actionPerformed(ActionEvent e) throws Exception
    {
        super.actionQueryScheme_actionPerformed(e);
    }

	protected String getEditUIName() {
		return null;
	}

	protected ICoreBase getBizInterface() throws Exception {
		return null;
	}
	
	protected void getRowSetBeforeFillTable(IRowSet rowSet) {
		super.getRowSetBeforeFillTable(rowSet);
		try {
			rowSet.beforeFirst();
			while(rowSet.next()){
				
				String jsfhtbhid="";
				String cllbid="";
				String xmmc="";
				String jldw="";
				String gcc="";
				if(rowSet.getString("jsfhtbh.id")!=null && rowSet.getString("cllb.id")!=null)
				{
					jsfhtbhid = rowSet.getString("jsfhtbh.id");
					cllbid = rowSet.getString("cllb.id");
					xmmc = rowSet.getString("xmmc.name");
					jldw = rowSet.getString("jldw.name");
					gcc = rowSet.getString("gcc.name");
					
				}
				IRowSet rs = SQLExecutorFactory.getRemoteInstance(sql(jsfhtbhid,cllbid,xmmc,jldw,gcc)).executeSQL();
				BigDecimal sl=new BigDecimal(0);
				BigDecimal ysyl=new BigDecimal(0);
				while(rs.next()){
					sl = rs.getBigDecimal("SUMSL");
					ysyl = rs.getBigDecimal("FYSYL");
		    	}
				rowSet.updateObject("entrys.sl", sl);
				rowSet.updateObject("BcxyDocMaterial.ysyl", ysyl);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}catch (Exception e) {
			e.printStackTrace();
		}
	}
	public String sql(String FJsfhtbhID,String FCllbID,String FXMMC,String FJLDW,String FGCC){
		return "SELECT  JSFHTBH.FNumber , XMMC.FName_l2 , " + //DISTINCT
			" CLLB.FName_l2 , JLDW.FName_l2 , " +
			" Sum(ENTRYS.FSl) AS SUMSL, BCXYDOCMATERIAL.FYSYL, " +
			" CLSRZBDOCNEW.FJsfhtbhID, ENTRYS.FCllbID, GCC.FName_l2 " +
			" FROM T_MAT_ClsrzbDocNew  CLSRZBDOCNEW " +
			" INNER JOIN T_MAT_ClsrzbDocNewEntry  ENTRYS " +
			" ON CLSRZBDOCNEW.FID = ENTRYS.FParentID " +
			" LEFT OUTER JOIN T_CON_BcxyDoc  BCXYDOC " +
			" ON CLSRZBDOCNEW.FBcxyid = BCXYDOC.FID " +
			" LEFT OUTER JOIN T_BD_GeneralAsstActType  JSFHTBH " +
			" ON CLSRZBDOCNEW.FJsfhtbhID = JSFHTBH.FID " +
			" LEFT OUTER JOIN T_BD_GeneralAsstActType  XMMC " +
			" ON CLSRZBDOCNEW.FXmmcID = XMMC.FID " +
			" INNER JOIN T_BD_GeneralAsstActType  GCC " +
			" ON CLSRZBDOCNEW.FGccID = GCC.FID " +
			" INNER JOIN T_BD_MeasureUnit  JLDW " +
			" ON ENTRYS.FJldwID = JLDW.FID " +
			" LEFT OUTER JOIN T_JCZ_Clxx  CLLB " +
			" ON ENTRYS.FCllbID = CLLB.FID " +
			" LEFT OUTER JOIN T_CON_BcxyDocMaterial  BCXYDOCMATERIAL " + 
			" ON CLSRZBDOCNEW.FBcxyid = BCXYDOCMATERIAL.FParentID  " +
			" and BCXYDOCMATERIAL.FMaterialTypeID=ENTRYS.FCllbID  " +
			" and BCXYDOCMATERIAL.FJldwID=ENTRYS.FJldwID  " +
			" where 1=1  " +
			" and CLSRZBDOCNEW.FJsfhtbhID='"+FJsfhtbhID+"'" +
			" and ENTRYS.FCllbID='"+FCllbID+"'" +
			" and XMMC.FName_l2='"+FXMMC+"'" +
			" and JLDW.FName_l2='"+FJLDW+"'" +
			" and GCC.FName_l2='"+FGCC+"'" +
			" GROUP BY JSFHTBH.FNumber, " +
			" XMMC.FName_l2, " +
			" CLLB.FName_l2, " +
			" JLDW.FName_l2, " +
			" CLSRZBDOCNEW.FJsfhtbhID, " +
			" ENTRYS.FCllbID, " +
			" BCXYDOCMATERIAL.FYSYL," +
			" GCC.FName_l2 " ;
	}
}